﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;
using System.Collections.Specialized;
using System.Text;

namespace BadmintonBuddy.Helpers
{
    public static class Utils
    {
        public static MvcHtmlString RenderScript(this HtmlHelper html, string fileName)
        {
            NameValueCollection appSettings= ConfigurationManager.AppSettings;
            string version = appSettings["version"];
            fileName = fileName + "?" + version;
            StringBuilder builder = new StringBuilder();
            builder.Append("<script type=\"text/javascript\" src=\"");
            builder.Append(fileName+"\"></script>");
            return MvcHtmlString.Create(builder.ToString());
        }

        public static MvcHtmlString RenderCss(this HtmlHelper html, string fileName)
        {            
            NameValueCollection appSettings = ConfigurationManager.AppSettings;
            string version = appSettings["version"];
            fileName = fileName + "?" + version;
            StringBuilder builder = new StringBuilder();
            builder.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
            builder.Append(fileName + "\"></link>");
            return MvcHtmlString.Create(builder.ToString());
        }
    }
}